package cn.webrx;

import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

public class Set1 {
    public static void main(String[] args) {
        //没有使用泛型，不推荐
        Set s1 = new HashSet();
        Set<String> s2 = new HashSet<>();
        Collection<Integer> s3 = new HashSet<>();

        Set<String> set = new HashSet<>();
        set.add("java");
        set.add("java");
        set.add("java");
        set.add("java");
        set.add("java");
        set.add("java");
        System.out.println(set);
        System.out.println(set.size());

        Set<User> su = new HashSet<>();
        su.add(new User(1,"aa",10));
        su.add(new User(1,"aa",10));
        su.add(new User(1,"aa",10));
        su.add(new User(1,"aa",10));
        System.out.println(su);
        System.out.println(su.size());
    }
}
